package com.xmy.cultivate.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.xmy.cultivate.converter.LocalDateConverter;
import com.xmy.cultivate.enums.StatusSchedulingEnum;
import io.swagger.annotations.ApiModel;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 排课详情
 * </p>
 *
 * @author min
 * @since 2022-08-01
 */
@ApiModel("排课详情")
@TableName("course_scheduling_detail")
@Data
public class CourseSchedulingDetail implements Serializable {

    private static final long serialVersionUID = 1L;

    @ExcelIgnore
    private Long id;

    @ExcelIgnore
    private Long pid;

    @ExcelIgnore
    private Long schoolId;

    @ExcelProperty(index = 2,value = "校区")
    private String schoolName;

    /**
     * 所属排课id
     */
    @ExcelIgnore
    private Long courseSchedulingId;

    /**
     * 班级id
     */
    @ExcelIgnore
    private Long gradeId;

    @ExcelProperty(index = 3,value = "班级")
    private String gradeName;

    @ExcelIgnore
    private Long courseId;

    @ExcelIgnore
    private String courseName;

    @ExcelIgnore
    private Integer lessonType;

    /**
     * 上课日期
     */
    @ExcelProperty(index = 0,value = "上课日期",converter = LocalDateConverter.class)
    private LocalDate schoolDate;

    @ExcelIgnore
    private Integer lessonNum;

    /**
     * 上课时段开始
     */
    @ExcelIgnore
    private String timeStart;

    /**
     * 上课时段结束
     */
    @ExcelIgnore
    private String timeEnd;

    @ExcelProperty(index = 1,value = "时间段")
    @TableField(exist = false)
    private String time;

    @ExcelIgnore
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startDateTime;

    @ExcelIgnore
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endDateTime;

    /**
     * 排课方式，1自由排课，2是重复排课
     */
    @ExcelIgnore
    private Integer arrangingWay;

    /**
     * 上课老师
     */
    @ExcelIgnore
    private Long teacherId;

    @ExcelProperty(index = 4,value = "教师")
    private String teacherName;

    /**
     * 助教id
     */
    @ExcelIgnore
    private Long assistantId;

    @ExcelIgnore
    private String assistantName;

    /**
     * 上课教室
     */
    @ExcelIgnore
    private Long classRoomId;

    @ExcelProperty(index = 5,value = "教室")
    private String classRoomName;

    /**
     * 科目id
     */
    @ExcelIgnore
    private Long subjectsId;

    @ExcelProperty(index = 6,value = "科目")
    private String subjectsName;

    @ExcelIgnore
    private Integer yearPart;

    @ExcelIgnore
    private Integer quarter;

    @ExcelIgnore
    private Integer useLeaveNum;

    /**
     * 是否锁住表，定时扣课时，用来避免重复扣，0否，1是
     */
    @ExcelIgnore
    private Integer isLock;

    /**
     * 创建人
     */
    @ExcelIgnore
    @TableField(fill = FieldFill.INSERT)
    private Long createdId;

    /**
     * deleted
     */
    @ExcelIgnore
    @TableLogic
    private Integer deleted;

    /**
     * created_at
     */
    @ExcelIgnore
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    /**
     * updated_at
     */
    @ExcelIgnore
    @TableField(fill = FieldFill.UPDATE)
    private LocalDateTime updatedAt;



    /**
     * deleted_at
     */
    @ExcelIgnore
    private LocalDateTime deletedAt;

    /**
     * 记上课
     */
    @ExcelIgnore
    private StatusSchedulingEnum status;

    @ExcelProperty(index = 7,value = "记上课状态")
    @TableField(exist = false)
    private String statusStr;

    /**
     * 1正常排课，2调课（通过调课改变时间）
     */
    @ExcelIgnore
    private Integer type;

    @ExcelIgnore
    @TableField(exist = false)
    private List<RecordCourse> recordCourseList;

    /**
     * 上课老师
     */
    @ExcelIgnore
    @TableField(exist = false)
    private Staff teacherObj;

    /**
     * 助教
     */
    @ExcelIgnore
    @TableField(exist = false)
    private Staff assistantObj;

    @ExcelIgnore
    @TableField(exist = false)
    private ClassRoom classRoomObj;

    @ExcelIgnore
    @TableField(exist = false)
    private Subjects subjectsObj;

    @ExcelIgnore
    @TableField(exist = false)
    private Grade gradeObj;

    @ExcelIgnore
    @TableField(exist = false)
    private Course courseObj;

    //上课校区
    @ExcelIgnore
    @TableField(exist = false)
    private Organization schoolObj;

    /**
     * 应到人数
     */
    @ExcelIgnore
    @TableField(exist = false)
    private Integer shouldCount;

    /**
     * 实到人数
     */
    @ExcelIgnore
    @TableField(exist = false)
    private Integer solidCount;

    @ExcelIgnore
    @TableField(exist = false)
    private Integer vacationCount;

    @ExcelIgnore
    @TableField(exist = false)
    private RepairCourse repairCourse;

    /**
     * 调出人数
     */
    @ExcelIgnore
    @TableField(exist = false)
    private Long outStudentCount;

    /**
     * 转出班级id(记录转校时自动创建班级是否已经创建)
     */
    @ExcelIgnore
    private Long outId;

    /**
     * 转出校区详情id
     */
    @ExcelIgnore
    private Long changeSchoolDetailId;

    /**
     * 未满班多少人，智能课排号使用
     */
    @ExcelIgnore
    @TableField(exist = false)
    private Integer underCount;

}
